<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>scrubber (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">labs.html.scrubber</span>
</div>

<hr/>


  <h2>Classes</h2>
   
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>



<h2>Enumerations</h2>






<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.Group_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">Group_</span>
        : 
     </div>


     <div class="entryOverview">
       Groups of elements used to specify containment relationships.

     </div>

     <div class="entryDetails">
       <div class="detailsSection">
          <b>Constants:</b>
          <table class="horiz-rule">
            <tbody>
              <tr><td>
                <span class="entryName">
                  AREA_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  BLOCK_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  CHARACTER_DATA_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  COL_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  DL_PART_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  FORM_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  HEAD_CONTENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  INLINE_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  INLINE_MINUS_A_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  LEGEND_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  LI_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  MIXED_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  OPTIONS_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  OPTION_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  PARAM_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  P_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TABLE_CONTENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TABLE_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TD_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TOP_CONTENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TR_ELEMENT_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
           </tbody>
         </table>
       </div>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line564">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.Scope_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">Scope_</span>
        : 
     </div>


     <div class="entryOverview">
       Element scopes limit where close tags can have effects.
For example, a table cannot be implicitly closed by a <code> &lt;/p&gt;</code> even if
the table appears inside a <code> &lt;p&gt;</code> because the <code> &lt;table&gt;</code> element
introduces a scope.


     </div>

     <div class="entryDetails">
       <div class="detailsSection">
          <b>Constants:</b>
          <table class="horiz-rule">
            <tbody>
              <tr><td>
                <span class="entryName">
                  BUTTON_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  COMMON_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  LIST_ITEM_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
              <tr><td>
                <span class="entryName">
                  TABLE_
                </span>
                <div class="entryOverview">
                  <span class='nodesc'>No description.</span>
                </div>
             </td></tr>
           </tbody>
         </table>
       </div>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line598">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.balance"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">balance<span class="args">(<span class="arg">html</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Balances tags in trusted HTML.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">html</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">a string of HTML</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            the input but with an end-tag for each non-void start tag
    and only for non-void start tags, and with start and end tags nesting
    properly.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line70">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.balance_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">balance_<span class="args">(<span class="arg">htmlTokens</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
      </div>


     <div class="entryOverview">
       Ensures that there are end-tags for all and only for non-void start tags.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">htmlTokens</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
        <div class="entryOverview">an array of HTML tokens as returned by
   <code> goog.labs.html.scrubber.lex</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;&nbsp;
            the input array modified in place to have some
   tokens removed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line422">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.filterAttrs_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">filterAttrs_<span class="args">(<span class="arg">attrsText</span>,&nbsp;<span class="arg">genericAttrWhitelist</span>,&nbsp;<span class="arg">tagSpecificAttrWhitelist</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Parses attribute names and values out of a tag body and applies the attribute
white-list to produce a tag body containing only safe attributes.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">attrsText</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">the text of a tag between the end of the tag name
  and the beginning of the tag end marker, so <code> " foo bar='baz'"</code> for
  the tag <code> &lt;tag foo bar='baz'/&gt;</code>.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">genericAttrWhitelist</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> goog.labs.html.AttributeRewriter</span>&gt;
        <div class="entryOverview">a whitelist of attribute transformations for attributes that are allowed
  on any element.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">tagSpecificAttrWhitelist</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> goog.labs.html.AttributeRewriter</span>&gt;
        <div class="entryOverview">a whitelist of attribute transformations for attributes that are allowed
  on the element started by the tag whose body is <code> tagBody</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            a tag-body that consists only of safe attributes.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line342">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.filter_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">filter_<span class="args">(<span class="arg">tagWhitelist</span>,&nbsp;<span class="arg">attrWhitelist</span>,&nbsp;<span class="arg">htmlTokens</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
      </div>


     <div class="entryOverview">
       Replaces tags not on the white-list with empty text nodes, dropping all
attributes, and drops other non-text nodes such as comments.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">tagWhitelist</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> boolean</span>&gt;
        <div class="entryOverview">a set of lower-case tag names
   following the convention established by <code> goog.object.createSet</code>.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">attrWhitelist</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> Object</span>.&lt;<span class="type">strin</span>&gt;,<span class="type"> goog.labs.html.AttributeRewriter>>
         </span>&gt;
        <div class="entryOverview">maps lower-case tag names and the special string <code> "*"</code> to functions
   from decoded attribute values to sanitized values or <code> null</code> to
   indicate that the attribute is not allowed with that value.

   For example, if <code> attrWhitelist['a']['href']</code> is defined then it is
   used to sanitize the value of the link's URL.

   If <code> attrWhitelist['*']['id']</code> is defined, and
   <code> attrWhitelist['div']['id']</code> is not, then the former is used to
   sanitize any <code> id</code> attribute on a <code> &lt;div&gt;</code> element.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">htmlTokens</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
        <div class="entryOverview">an array of HTML tokens as returned by
   <code> goog.labs.html.scrubber.lex_</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;&nbsp;
            the input array modified in place to have some
   tokens removed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line272">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.lex_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">lex_<span class="args">(<span class="arg">html</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
      </div>


     <div class="entryOverview">
       Returns an array of HTML tokens including tags, text nodes and comments.
"Special" elements, like <code> &lt;script&gt;...&lt;/script&gt;</code> whose bodies cannot
include nested elements, are returned as single tokens.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">html</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">a string of HTML</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;&nbsp;
            <span class='nodesc'>No description.</span>
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line243">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.pickElementsToClose_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">pickElementsToClose_<span class="args">(<span class="arg">lowerCaseTagName</span>,&nbsp;<span class="arg">isCloseTag</span>,&nbsp;<span class="arg">openElementStack</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
      </div>


     <div class="entryOverview">
       Picks which open HTML elements to close.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">lowerCaseTagName</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The name of the tag.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">isCloseTag</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
        <div class="entryOverview">True for a <code> &lt;/tagname&gt;</code> tag.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">openElementStack</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
        <div class="entryOverview">The names of elements that have been
                                         opened and not subsequently closed.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>&nbsp;
            the length of openElementStack after closing any tags that
              need to be closed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line625">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.readOwnProperty_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">readOwnProperty_<span class="args">(<span class="arg">o</span>,&nbsp;<span class="arg">k</span>)</span>
        </span>
        &#8658; <span class="type">*</span>
      </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">o</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>
        <div class="entryOverview">the object</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">k</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">a key into o</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type">*</span>&nbsp;
            <span class='nodesc'>No description.</span>
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line392">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.render_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">render_<span class="args">(<span class="arg">htmlTokens</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Normalizes HTML tokens and concatenates them into a string.

     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">htmlTokens</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&gt;
        <div class="entryOverview">an array of HTML tokens as returned by
   <code> goog.labs.html.scrubber.lex</code>.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            a string of HTML.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line538">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.labs.html.scrubber.scrub"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">scrub<span class="args">(<span class="arg">tagWhitelist</span>,&nbsp;<span class="arg">attrWhitelist</span>,&nbsp;<span class="arg">html</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Replaces tags not on the white-list with empty text nodes, dropping all
attributes, and drops other non-text nodes such as comments.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">tagWhitelist</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> boolean</span>&gt;
        <div class="entryOverview">a set of lower-case tag names
   following the convention established by <code> goog.object.createSet</code>.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">attrWhitelist</span>
        : <span>!</span><span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Object">Object</a></span>.&lt;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>,<span class="type"> Object</span>.&lt;<span class="type">strin</span>&gt;,<span class="type"> goog.labs.html.AttributeRewriter></span>&gt;
        <div class="entryOverview">maps lower-case tag names and the special string <code> "*"</code> to functions
   from decoded attribute values to sanitized values or <code> null</code> to
   indicate that the attribute is not allowed with that value.

   For example, if <code> attrWhitelist['a']['href']</code> is defined then it
   is used to sanitize the value of the link's URL.

   If <code> attrWhitelist['*']['id']</code> is defined, and
   <code> attrWhitelist['div']['id']</code> is not, then the former is used to
   sanitize any <code> id</code> attribute on a <code> &lt;div&gt;</code> element.</div>
     </td>
   </tr>
     
   <tr class="even">
     <td>
        <span class="entryName">html</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">a string of HTML</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            the input but with potentially dangerous tokens removed.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line53">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



  <h2>Global Properties</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ALL_SCOPES_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ALL_SCOPES_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line607">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ATTRS_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ATTRS_</span>
        : 
     </div>


     <div class="entryOverview">
       The body of a tag between the end of the name and the closing <code> &gt;</code>
if any.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line129">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ATTRS_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ATTRS_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       A global matcher that separates attributes out of the tag body cruft.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line230">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ATTR_VALUE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ATTR_VALUE_</span>
        : 
     </div>


     <div class="entryOverview">
       Matches the equals-sign and any attribute value following it, but does not
capture any <code> &gt;</code> that would close the tag.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line118">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ATTR_VALUE_PRECEDER_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ATTR_VALUE_PRECEDER_</span>
        : 
     </div>


     <div class="entryOverview">
       Matches content following a tag name or attribute value, and before the
beginning of the next attribute value.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line98">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.BALANCE_NESTING_LIMIT_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">BALANCE_NESTING_LIMIT_</span>
        : 
     </div>


     <div class="entryOverview">
       We limit the nesting limit of balanced HTML to a large but manageable number
so that built-in browser limits aren't likely to kick in and undo all our
matching of start and end tags.
<br/>
This mitigates the HTML parsing equivalent of stack smashing attacks.
<br/>
Otherwise, crafted inputs like
<code> &lt;p&gt;&lt;p&gt;&lt;p&gt;&lt;p&gt;...Ad nauseam...&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</code> could exploit
browser bugs, and/or undocumented nesting limit recovery code to misnest
tags.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line411">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.BLOCK_CONTAINERS_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">BLOCK_CONTAINERS_</span>
        : 
     </div>


     <div class="entryOverview">
       Per-element, a child that can contain block content.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line1018">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.BREAK_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">BREAK_</span>
        : 
     </div>


     <div class="entryOverview">
       Matches when the next character cannot continue a tag name.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line146">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.CC_BANG_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">CC_BANG_</span>
        : 
     </div>


     <div class="entryOverview">
       Character code constant for <code> '!'</code>.  @private 
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line82">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.CC_LT_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">CC_LT_</span>
        : 
     </div>


     <div class="entryOverview">
       Character code constant for <code> '&lt;'</code>.  @private 
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line78">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.CC_QMARK_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">CC_QMARK_</span>
        : 
     </div>


     <div class="entryOverview">
       Character code constant for <code> '?'</code>.  @private 
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line90">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.CC_SLASH_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">CC_SLASH_</span>
        : 
     </div>


     <div class="entryOverview">
       Character code constant for <code> '/'</code>.  @private 
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line86">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.COMMENT_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">COMMENT_</span>
        : 
     </div>


     <div class="entryOverview">
       Matches HTML comments including HTML 5 "bogus comments" of the form
<code> &lt;!...&gt;</code> or <code> &lt;?...&gt;</code> or <code> &lt;/...&gt;</code>.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line196">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.DOUBLE_QUOTED_ATTR_VALUE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">DOUBLE_QUOTED_ATTR_VALUE_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line106">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ELEMENT_CONTENTS_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ELEMENT_CONTENTS_</span>
        : 
     </div>


     <div class="entryOverview">
       The groups which the element can contain.
Defaults to 0.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line859">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ELEMENT_GROUPS_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ELEMENT_GROUPS_</span>
        : 
     </div>


     <div class="entryOverview">
       The groups into which the element falls.
The default is an inline element.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line681">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.ELEMENT_SCOPES_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">ELEMENT_SCOPES_</span>
        : 
     </div>


     <div class="entryOverview">
       The scopes in which an element falls.
No property defaults to 0.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line984">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.HTML_TOKENS_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">HTML_TOKENS_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regexp pattern for an HTML token after a doctype.
Special elements introduces a capturing group for use with a
back-reference.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line207">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.SINGLE_QUOTED_ATTR_VALUE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">SINGLE_QUOTED_ATTR_VALUE_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line110">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.SPECIAL_ELEMENT_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">SPECIAL_ELEMENT_</span>
        : 
     </div>


     <div class="entryOverview">
       Matches the open tag and body of a special element :
one whose body cannot contain nested elements so uses special parsing rules.
It does not include the end tag.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line156">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.TAG_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">TAG_</span>
        : 
     </div>


     <div class="entryOverview">
       Regexp pattern for an HTML tag.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line179">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.TAG_NAME_CHAR_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">TAG_NAME_CHAR_</span>
        : 
     </div>


     <div class="entryOverview">
       A character that continues a tag name as defined at
<a href="http://www.w3.org/html/wg/drafts/html/master/syntax.html#tag-name-state">http://www.w3.org/html/wg/drafts/html/master/syntax.html#tag-name-state</a>

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line139">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.TAG_RE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">TAG_RE_</span>
        : 
     </div>


     <div class="entryOverview">
       An HTML tag which captures the name in group 1,
and any attributes in group 2.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line220">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.TEXT_NODE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">TEXT_NODE_</span>
        : 
     </div>


     <div class="entryOverview">
       Regexp pattern for an HTML text node.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line188">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.labs.html.scrubber.UNQUOTED_ATTR_VALUE_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.labs.html.scrubber.</span><span class="entryName">UNQUOTED_ATTR_VALUE_</span>
        : 
     </div>


     <div class="entryOverview">
       <span class='nodesc'>No description.</span>
     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_labs_html_scrubber.js.source.html#line102">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package labs.html</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="labs.html.scrubber"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
